﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Heavy_Metals
{
    public partial class CompanyInfoForm : Form
    {
        public CompanyInfoForm()
        {
            InitializeComponent();
            this.dataGridView1.Rows.Add();
            this.dataGridView1.Rows[0].Cells[0].Value = "Usr1";
            this.dataGridView1.Rows[0].Cells[1].Value = "牡丹江分局";
            this.dataGridView1.Rows[0].Cells[2].Value = "P23";
            this.dataGridView1.Rows[0].Cells[3].Value = "查看";
            this.dataGridView1.Rows[0].Cells[4].Value = "删除";

            this.dataGridView1.Rows.Add();
            this.dataGridView1.Rows[1].Cells[0].Value = "Usr2";
            this.dataGridView1.Rows[1].Cells[1].Value = "齐齐哈尔分局";
            this.dataGridView1.Rows[1].Cells[2].Value = "P34";
            this.dataGridView1.Rows[1].Cells[3].Value = "查看";
            this.dataGridView1.Rows[1].Cells[4].Value = "删除";
        }

        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == 4)
            {
                DialogResult response = MessageBox.Show("您确定要删除？", "请确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
                if (response == System.Windows.Forms.DialogResult.Yes)
                {
                    this.dataGridView1.Rows.RemoveAt(e.RowIndex);
                }
            }
            else if (e.ColumnIndex == 3)
            {
                CompanyInfoDetailForm mdfForm = new CompanyInfoDetailForm();
                mdfForm.Show();
            }
        }
    }
}
